package net.huashitong.oversee.service;

import com.sirdc.modules.core.dao.BaseDao;
import com.sirdc.modules.sys.base.StringPKService;
import com.sirdc.modules.sys.service.SysTableService;
import com.sirdc.modules.utils.ObjectUtils;
import com.sirdc.modules.utils.StringUtils;
import net.huashitong.Project.entity.EarlyWarningNode;
import net.huashitong.Project.entity.NewProjects;
import net.huashitong.Project.service.EarlyWarningNodeService;
import net.huashitong.Project.service.NewProjectsService;
import net.huashitong.node.entity.NodeNewschedules;
import net.huashitong.node.filter.NodeNewschedulesFilter;
import net.huashitong.node.service.NodeNewschedulesService;
import net.huashitong.oversee.dao.SupervisionTaskDao;
import net.huashitong.oversee.entity.GradePoint;
import net.huashitong.oversee.entity.SupervisionLog;
import net.huashitong.oversee.entity.SupervisionTask;
import net.huashitong.oversee.entity.TaskMethon;
import net.huashitong.oversee.filter.CoordinateFilter;
import net.huashitong.oversee.filter.SupervisionTaskFilter;
import net.huashitong.oversee.filter.TaskLogFilter;
import net.huashitong.taskGroup.entity.DeptList;
import net.huashitong.taskGroup.entity.JobGroup;
import net.huashitong.taskGroup.service.DeptListService;
import net.huashitong.taskGroup.service.JobGroupService;
import net.huashitong.user.entity.BnpUser;
import net.huashitong.user.service.BnpUserService;
import net.huashitong.utils.UtilsTools;
import net.huashitong.utils.WordUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.text.ParseException;
import java.util.*;


@Service
public class SupervisionTaskService extends StringPKService<SupervisionTask> {
    @Override
    protected BaseDao<SupervisionTask, String> getDao() {
        return dao;
    }

    @Autowired
    @Lazy
    private NewProjectsService projectsService;
    @Autowired
    private EarlyWarningNodeService earlyWarningNodeService;
    @Autowired
    private JobGroupService jobGroupService;
    @Autowired
    private DeptListService deptListService;
    @Autowired
    @Lazy
    private GradePointService gradePointService;
    @Autowired
    private BnpUserService bnpUserService;
    @Autowired
    private TaskMethonService methonService;

//    @Autowired
//    private GradePointService gradePointService;


    //保存前会自动调用，设置主键ID
    @Override
    protected void beforeSave(SupervisionTask obj) {
        obj.setSysId(tableService.updateMaxSysId("t_bnp_supervision_task", null));
    }

    @Autowired
    private SupervisionLogService supervisionLogService;

    @Autowired
    private SysTableService tableService;

    @Autowired
    private SupervisionTaskDao dao;

    @Autowired
    private NodeNewschedulesService nodeNewschedulesService;


    /**
     * 查询任务主要入口
     *
     * @param filter
     * @return
     */
    public List<SupervisionTask> getTaskLists(SupervisionTaskFilter filter) {
        if ("6".equals(filter.getBranchType())) {
            //县分管领导权限
            return dao.queryByFilterInLeader(filter);
        } else {
            return dao.getMissinTask(filter);
        }
    }


    /**
     * 查询督查任务（类似上面方法除了没有分页）
     *
     * @param filter
     * @return
     */
    public List<SupervisionTask> getTaskListsNoPage(SupervisionTaskFilter filter) {
        return dao.getTaskListsNoPage(filter);
    }

    public List<SupervisionTask> queryByOperator(String phone, String name) {
        return dao.queryByOperator(phone, name);
    }

    public List<SupervisionTask> queryByResUser(String phone, String name) {
        return dao.queryByResUser(phone, name);
    }


    public List<SupervisionTask> queryTasksByIds(List<String> ids) {
        return dao.queryTasksByIds(ids);
    }

    /**
     * 修改任务
     *
     * @param filter
     * @param task
     */
    public void updateTaskJob(SupervisionTaskFilter filter, SupervisionTask task) {

        BeanUtils.copyProperties(filter, task);
        JobGroup group = jobGroupService.getbyCode(filter.getGroupId());
        task.setGroupType(group.getGroupName()); //督查组名称
        task.setPhones(group.getGroupTel());//督查组联系号码
        task.setInspectors(group.getGroupContact());// 督查组联系人


        update(task);

    }

    public List<SupervisionLog> querySupervisionLogByTaskId(String taskId) {
        TaskLogFilter filter = new TaskLogFilter();
        filter.setTaskId(taskId);
        List<SupervisionLog> list = supervisionLogService.querySupervisionLogs(filter);
        return list;
    }


    //保存收到新建任务
    public String saveSupervisionTask(SupervisionTaskFilter filter, String user) {

        SupervisionTask task = new SupervisionTask();
        BeanUtils.copyProperties(filter, task);
        JobGroup group = jobGroupService.getbyCode(task.getGroupId());
        task.setPhones(group.getGroupTel());
        task.setGroupType(group.getGroupName());

        task.setTasktimes("1"); //督查次数默认1
        task.setAaa001("1");
        task.setTaskResult("0"); //责任单位完成情况默认为0
        task.setSupervisionResult("0");//督查组完成情况默认为0
        task.setRespResult("0");//责任单位完成情况默认为0
        task.setPlanStartDate(filter.getPlanStartDate()); // 任务开始时间默认为当前日期
        task.setPlanEndDate(filter.getPlanEndDate()); // 任务开始时间默认为当前日期
        task.setIsfeedback("0");//是否反馈攻坚办
        task.setTaskDate(filter.getTaskDate());
        task.setAaa002("0");
        task.setTaskjobType("手动创建");
        task.setCreateUser(user);
       /* try {
            task.setPlanEndDate(UtilsTools.plusDay(15,UtilsTools.getCurrentDate())); //设置结束时间
        } catch (ParseException e) {
            e.printStackTrace();
        }*/

        save(task);

        return task.getSysId();
    }

    //事项处理生成任务
    public void saveSupervisionTask1(SupervisionTaskFilter filter) {
        SupervisionTask task = new SupervisionTask();
        BeanUtils.copyProperties(filter, task);
        save(task);
    }

    //保存到督查系统
    public void saveTasktoDuCha(String sysId) {
        dao.saveDuChatask(sysId);
    }

    /**
     * 问题批转 生成
     *
     * @param filter
     */
    public String saveAutoTaskJob(CoordinateFilter filter, List<SupervisionTask> list) {

        SupervisionTask taskjob = new SupervisionTask();
        if (ObjectUtils.isNotBlank(list) && list.size() > 0) {
            taskjob = list.get(0);
        } else {
            taskjob.setAaa002("0"); //短信发送
            taskjob.setTasktimes("1"); //督查次数默认1
            taskjob.setAaa001("1"); //督查任务有效标志
            taskjob.setTaskResult("0"); //责任单位完成情况默认为0
            taskjob.setSupervisionResult("0");//督查组完成情况默认为0
            taskjob.setRespResult("0");//责任单位完成情况默认为0
        }
        taskjob.setProjectName(filter.getProjectName());
        //taskjob.setProjectId(filter.getSysId());
        if (StringUtils.isNotBlank(filter.getGroupCode())) {
            taskjob.setGroupId(filter.getGroupCode());
            JobGroup group = jobGroupService.getbyCode(filter.getGroupCode());
            taskjob.setPhones(group.getGroupTel()); //督查组电话
            taskjob.setInspectors(group.getGroupContact()); //督查联系人
            taskjob.setGroupType(group.getGroupName());//督查组类型
        }
        //taskjob.setNodeId(waring.getNodeId());//节点id
        // taskjob.setNodeName(waring.getNodeName());// 节点名称
        taskjob.setInvolveUnit(filter.getInvolveUnit());
        taskjob.setResDept(filter.getResDept());// 责任单位
        taskjob.setResPhone(filter.getResUserPhone());// 责任人号码
        taskjob.setResUser(filter.getResUser());//责任人
        taskjob.setOperatorUser(filter.getOperator());//经办人
        taskjob.setOperatorPhone(filter.getOperatorPhone());//经办人电话。
        taskjob.setTaskName(StringUtils.isNotBlank(filter.getTaskName())?filter.getTaskName().replace("逾期", "超期"):null);
        taskjob.setTaskContent(StringUtils.isNotBlank(filter.getTaskContent())?filter.getTaskContent().replace("逾期", "超期"):null);
        taskjob.setTaskjobType("协调批转");
        taskjob.setTackFlag("1");                               //表示为攻坚任务
        taskjob.setTackTaskType("提请协调");                           //表示提请协调
        taskjob.setPlanStartDate(filter.getStartDate());        //任务开始时间默认为当前日期
        taskjob.setPlanEndDate(filter.getEndDate());
        taskjob.setIsfeedback("1");                             //是否反馈攻坚办
        if(StringUtils.isBlank(taskjob.getSysId())){
            save(taskjob);
        }else{
            update(taskjob);
        }
        return taskjob.getSysId();
    }


    /**
     * 根据预警列表自动生成督查任务
     */
    public String saveAutoTaskJob(EarlyWarningNode waring) {
        NewProjects project = projectsService.getById(waring.getProjectId());
        //获取大节点名称
        String bigNodeName = "";
        NodeNewschedulesFilter nodeNewschedulesFilter = new NodeNewschedulesFilter();
        if (StringUtils.isNotBlank(waring.getProjectId()) && StringUtils.isNotBlank(waring.getNodeId())) {
            nodeNewschedulesFilter.setProjectId(waring.getProjectId());
            String[] arr = waring.getNodeId().split("\\.");
            nodeNewschedulesFilter.setNodeId(arr[0]);
            List<NodeNewschedules> list = nodeNewschedulesService.queryByFilter(nodeNewschedulesFilter);
            bigNodeName = list.get(0).getNodeName();
        }
        //获取督查节点
        NodeNewschedulesFilter nodeNewschedulesFilter1 = new NodeNewschedulesFilter();
        nodeNewschedulesFilter1.setNodeId(waring.getNodeId());
        nodeNewschedulesFilter1.setProjectId(waring.getProjectId());
        NodeNewschedules node = nodeNewschedulesService.getById(waring.getNodeSysId());
        String groupCode = node.getGroupCode();
        String groupName = node.getGroupName();
        String planTime = node.getPlanTime();

        int planTimeInt = Integer.parseInt(planTime);
        int taskDate = 1;
        if (!(planTimeInt == 0 || planTimeInt == 1)) {
            taskDate = planTimeInt / 2;
            int remainder = planTimeInt % 2;         //取余数
            if (remainder != 0) {
                taskDate = taskDate + 1;
            }
        }
        if (taskDate > 15) {
            taskDate = 15;
        }

        if (StringUtils.isBlank(groupCode)) {
            groupCode = project.getGroupCode();
        }
        if (StringUtils.isBlank(groupName)) {
            groupName = project.getGroupName();
        }

        SupervisionTask taskjob = new SupervisionTask();
        taskjob.setProjectName(project.getName());
        taskjob.setProjectId(waring.getProjectId());
        taskjob.setGroupId(groupCode);
        taskjob.setGroupType(groupName);

        JobGroup group = jobGroupService.getbyCode(groupCode);
        taskjob.setPhones(group.getGroupTel()); //督查组电话
        taskjob.setInspectors(group.getGroupContact()); //督查联系人

        taskjob.setNodeId(waring.getNodeId());//节点id
        taskjob.setNodeName("-" + bigNodeName + "-" + waring.getNodeName());// 节点名称
        if (node.getResDept().contains("业主") || node.getResDept().contains("中介")) {
            taskjob.setResDept(project.getResDept());// 责任单位
        } else {
            taskjob.setResDept(node.getResDept());// 责任单位
        }

        taskjob.setResPhone(waring.getResUserPhone());// 责任人号码
        taskjob.setResUser(waring.getResUser());//责任人
        taskjob.setOperatorUser(waring.getOperatorUser());//经办人
        taskjob.setOperatorPhone(waring.getOperatorPhone());//经办人电话。
        taskjob.setTaskName(project.getName() + taskjob.getNodeId() + taskjob.getNodeName() + "超期");
        taskjob.setTaskContent(project.getName() + taskjob.getNodeId() + taskjob.getNodeName() + "超期," + "请相关单位及时处理！");
        taskjob.setTaskjobType("自动生成");
        taskjob.setAaa002("0");
        taskjob.setTasktimes("1"); //督查次数默认1
        taskjob.setAaa001("1"); //督查任务有效标志
        taskjob.setTaskResult("0"); //责任单位完成情况默认为0
        taskjob.setSupervisionResult("0");//督查组完成情况默认为0
        taskjob.setSupervisionScore("0.0");//默认得分
        taskjob.setRespResult("0");//责任单位完成情况默认为0
        taskjob.setRespScore("0.0");//默认得分
        taskjob.setCreateUser("admin");
        //计划开始时间默认为当前日期
        taskjob.setPlanStartDate(UtilsTools.getCurrentDate());
        try {
            //计划结束时间
            taskjob.setPlanEndDate(UtilsTools.plusDay(taskDate, UtilsTools.getCurrentDate()));
            //实际开始时间（同上）
            taskjob.setStartDate(UtilsTools.getCurrentDate());
            //实际结束时间（默认为空）
            taskjob.setEndDate(null);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        taskjob.setIsfeedback("0");//是否反馈攻坚办
        taskjob.setTaskDate(taskDate + "");
        taskjob.setNodeSysId(waring.getNodeSysId());
        taskjob.setOverdueDays("1");
        BnpUser user = bnpUserService.getBnpUserByPhoneAndName(waring.getOperatorPhone(), waring.getOperatorUser());
        if (ObjectUtils.isNotBlank(user)) {
            //经办人的id
            taskjob.setUserid(user.getSysId());
        }

        save(taskjob);
        return taskjob.getSysId();
    }

    /**
     * 获取所有未发送短信的督查任务
     */
    public List<SupervisionTask> getNotSendMsg() {
        return dao.getNotSendStatue();
    }

    /**
     * 封装涉及部门
     */
    public List<SupervisionTask> involveUnitDealWith(List<SupervisionTask> lists) {

        //封装涉及部门
        Map<String, String> deptsMap = new HashMap<>();
        List<DeptList> deptLists = deptListService.query();
        for (DeptList dept : deptLists) {
            if (!deptsMap.containsKey(dept.getDeptCode())) {
                deptsMap.put(dept.getDeptCode(), dept.getDeptName());
            }
        }

        String deptList = "";
        for (SupervisionTask task : lists) {
            if (StringUtils.isNotBlank(task.getInvolveUnit())) {
                String arrStr = task.getInvolveUnit();
                String[] arr = arrStr.split(",");
                for (int i = 0; i < arr.length; i++) {
                    if (i > 0) {
                        deptList += "," + deptsMap.get(arr[i]);
                    } else {
                        deptList += deptsMap.get(arr[i]);
                    }

                }
                task.setInvolveUnit(deptList);
            }
        }
        return lists;
    }

    //我的消息

    public int getMyTask(BnpUser user) {
        return dao.getmyTasks(user).size();
    }

    public int getMissinTaskCount(SupervisionTaskFilter filter) {
        if ("6".equals(filter.getBranchType())) {
            return dao.getMissinTaskCount1(filter);
        } else {
            return dao.getMissinTaskCount(filter);
        }
    }

    public String updateAllTaskRespAndSupervisionScore() {
        //查询所有绩效得分
        List<GradePoint> gradePoints = gradePointService.query();
        //封装考核督查组的得分
        Map<String, String> supervisionScoreMap = new HashMap<>();
        //封装考核责任单位的得分
        Map<String, String> respScoreMap = new HashMap<>();
        for (GradePoint g : gradePoints) {
            if (!g.getTaskId().contains("sch_")) {
                //进入督查任务的绩效得分
                //如果考核对象是"A"开头，则表示这个考核单位是督查组
                if (g.getCheckObjectId().contains("A")) {
                    if (!supervisionScoreMap.containsKey(g.getTaskId())) {
                        supervisionScoreMap.put(g.getTaskId(), g.getSoucre());
                    }
                } else {
                    if (!respScoreMap.containsKey(g.getTaskId())) {
                        respScoreMap.put(g.getTaskId(), g.getSoucre());
                    }
                }
            }
        }
        //查询所有督查任务
        List<SupervisionTask> tasks = query();
        for (SupervisionTask t : tasks) {
            if ("0".equals(t.getAaa001())) {

            }
            //如果责任单位或者督查组的得分为空，则需要填充分数
            if ((StringUtils.isBlank(t.getRespScore()) || StringUtils.isBlank(t.getSupervisionScore()))
                    & "1".equals(t.getAaa001())) {
                if (StringUtils.isNotBlank(respScoreMap.get(t.getSysId()))) {
                    t.setRespScore(respScoreMap.get(t.getSysId()));
                }
                if (StringUtils.isNotBlank(supervisionScoreMap.get(t.getSysId()))) {
                    t.setSupervisionScore(supervisionScoreMap.get(t.getSysId()));
                }
            } else if ("0".equals(t.getAaa001())) {
                t.setRespScore("0.0");
                t.setSupervisionScore("0.0");
            }
        }
        batchUpdate(tasks);
        return "ok";
    }

    public List<SupervisionTask> querySupervisionTaskByFilter(SupervisionTaskFilter filter) {
        return dao.querySupervisionTaskByFilter(filter);
    }

    public List<SupervisionTask> getDoing(String name, String role) {
        return dao.getDoing(name, role);
    }


    //节点完成，相应的督查任务也完成
    public void updateTaskByNodeFinish(String nodeSysId) {
        SupervisionTaskFilter filter = new SupervisionTaskFilter();
        filter.setNodeSysId(nodeSysId);
        List<SupervisionTask> tasks = this.querySupervisionTaskByFilter(filter);
        for (SupervisionTask task : tasks) {
            task.setRespResult("1");

        }
        this.batchUpdate(tasks);
    }

    public Map<String, Integer> getSupervisionNums(BnpUser bnpUser) {
        Map<String, Integer> result = new HashMap<>();
        for (int i = 1; i <= 3; i++) {
            SupervisionTaskFilter taskFilter = new SupervisionTaskFilter();
            taskFilter.setUserinfo(bnpUser.getPhone());
            taskFilter.setBranchType(bnpUser.getBranchType());
            taskFilter.setRole(bnpUser.getRole());
            taskFilter.setValid("1");
            taskFilter.setTasktimes(i + "");
            Integer num = this.getMissinTaskCount(taskFilter);
            result.put("num" + i, num);
        }
        return result;
    }


    public Map<String, Integer> getTackTaskEachNums(BnpUser bnpUser) {
        Map<String, Integer> result = new HashMap<>();
        for (int i = 1; i <= 3; i++) {
            //1进入攻坚待反馈  2已反馈待审核  3已审核完成
            SupervisionTaskFilter taskFilter = new SupervisionTaskFilter();
            taskFilter.setUserinfo(bnpUser.getPhone());
            taskFilter.setBranchType(bnpUser.getBranchType());
            taskFilter.setRole(bnpUser.getRole());
            taskFilter.setValid("1");
            taskFilter.setTackFlag(i + "");
            Integer num = this.getMissinTaskCount(taskFilter);
            result.put("num" + i, num);
        }
        return result;
    }


    /**
     * 导出项目报告（word）
     *
     * @param reponse
     * @param project
     * @param task
     */
    public void exportProjectReportWord(HttpServletResponse reponse, NewProjects project, SupervisionTask task, List<SupervisionLog> logs) {
        Map<String, Object> map = new HashMap<>();
        map.put("projectName", project.getName());               //项目名称
        map.put("startDate", project.getPlanBeginDate());        //项目节点开始时间
        map.put("planFinishDate", project.getStartTime());       //项目节点计划完成时间
        //获取所有确定需要的大节点
        List<NodeNewschedules> bigNode = nodeNewschedulesService.getNeedBigNodeByProjectId(project.getSysId());
        String bigNodeNumStr = bigNode.size() + "";
        map.put("bigNodeNum", bigNodeNumStr);        //全部大节点个数
        int bigFinished = 0;
        for (NodeNewschedules big : bigNode) {
            if ("2".equals(big.getStatus())) {
                bigFinished++;
            }
        }
        map.put("finishedBigNodeNum", bigFinished + "");        //大节点完成个数
        //获取所有确定需要的小节点
        List<NodeNewschedules> smallNode = nodeNewschedulesService.getNeedSmallNodeByProjectId(project.getSysId());
        String smallNodeNumStr = smallNode.size() + "";
        map.put("smallNodeNum", smallNodeNumStr);    //全部小节点个数
        int factTimeCount = 0;      //实际用时
        int planTimeCount = 0;      //计划用时
        int surplusSmallNodeCount = 0;              //剩余小节点个数
        int surplusSmallNodePlanTimeCount = 0;      //剩余小节点计划用时
        //已完成的小节点
        List<NodeNewschedules> finishedNode = new ArrayList<>();
        //当前节点信息
        //开始于 月 日
        String startTime = "";
        String resDept = "";
        String groupType = "";
        for (NodeNewschedules small : smallNode) {
            if ("2".equals(small.getStatus())) {
                factTimeCount = factTimeCount +
                        Integer.parseInt(
                                StringUtils.isBlank(small.getFactTime()) ? "0" : small.getFactTime());
                planTimeCount = planTimeCount +
                        Integer.parseInt(
                                StringUtils.isBlank(small.getPlanTime()) ? "0" : small.getPlanTime());
                finishedNode.add(small);
            } else {
                surplusSmallNodeCount++;
                surplusSmallNodePlanTimeCount = surplusSmallNodePlanTimeCount +
                        Integer.parseInt(
                                StringUtils.isBlank(small.getPlanTime()) ? "0" : small.getPlanTime());
            }
            if (task.getNodeId().equals(small.getNodeId())) {
                map.put("currentNodePlanTime", small.getPlanTime());
                startTime = small.getPlanBeginDate();
                resDept = task.getResDept();
                groupType = task.getGroupType().replace(",", "");
            }
        }
        //如果实际用时小于计划用时则 超前，反之则逾期；
        String state;
        int days;
        if (factTimeCount < planTimeCount) {
            state = "超前";
            days = planTimeCount - factTimeCount;
        } else {
            state = "逾期";
            days = factTimeCount - planTimeCount;
        }

        map.put("factTime", factTimeCount + "");
        map.put("days", days + "");
        map.put("planTime", planTimeCount + "");
        map.put("state", state);
        map.put("surplusSmallNodeCount", surplusSmallNodeCount + "");
        map.put("surplusSmallNodePlanTimeCount", surplusSmallNodePlanTimeCount + "");

        //=======================已完成的节点=======================
        if (finishedNode.size() > 0) {
            List<NodeNewschedules> list = new ArrayList<>();
            Collections.sort(finishedNode, new Comparator<NodeNewschedules>() {
                @Override
                public int compare(NodeNewschedules h1, NodeNewschedules h2) {
                    int i1 = Integer.parseInt(
                            StringUtils.isBlank(h1.getFactTime()) ? "0" : h1.getFactTime());
                    int i2 = Integer.parseInt(
                            StringUtils.isBlank(h2.getFactTime()) ? "0" : h2.getFactTime());
                    if (i1 > i2) {
                        return -1;
                    } else if (i1 < i2) {
                        return 1;
                    } else {
                        return 0;
                    }
                }
            });
            if (finishedNode.size() >= 3) {
                list.add(finishedNode.get(0));
                list.add(finishedNode.get(1));
                list.add(finishedNode.get(2));
            } else if (finishedNode.size() == 2) {
                list.add(finishedNode.get(0));
                list.add(finishedNode.get(1));
            } else {
                list.add(finishedNode.get(0));
            }
            map.put("nodeList", list);
        }


        map.put("currentNode", task.getNodeId() + task.getNodeName() + "，项目开始于" + startTime);


        map.put("overDueDay", task.getOverdueDays());            //逾期天数
        if ("3".equals(task.getTasktimes())) {
            if ("0".equals(task.getTaskResult())) {
                map.put("stage", "第三轮督查");
            } else {
                map.put("stage", "攻坚");
            }
        } else {
            if ("1".equals(task.getTasktimes())) {
                map.put("stage", "第一轮督查");
            }
            if ("2".equals(task.getTasktimes())) {
                map.put("stage", "第二轮督查");
            }
        }

        //
        for (SupervisionLog log : logs) {
            if (StringUtils.isBlank(log.getSupervisionTeamId())) {
                //督查组
                String methonName = "";
                if (StringUtils.isNotBlank(log.getMethonCode())) {
                    TaskMethon methon = methonService.getMethon(log.getMethonCode());
                    methonName = methon.getMethonName();
                }
                log.setSupervisionTeamId("督查组(" + groupType + ")");
                log.setDeadline("通过" + methonName + "，" + log.getRecord() + log.getSupervisionAsk());
            } else {
                //责任单位
                log.setSupervisionTeamId("责任单位(" + resDept + ")");
                log.setDeadline("反馈消息：" + log.getRecord());
            }
        }
        map.put("logs", logs);
        try {
            WordUtil.exportWrodFile(reponse, map, "projectReportMould.ftl", project.getName() + "项目简报.doc");
        } catch (IOException e) {
            e.printStackTrace();
        }
    }


    //修改人员，同步更新督查任务、绩效得分、总分、逾期节点
    public void updateUserSynchronization() {

    }


}
